﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BYManageInfoSystem
{
    public static class CommonCompute
    {
        //四舍五入
        public static decimal ChinaRound(decimal value, int decimals)
        {
            if (value < 0)
            {
                return Math.Round(value + (decimal)(5 / Math.Pow(10, decimals + 1)), decimals, MidpointRounding.AwayFromZero);
            }
            else
            {
                return Math.Round(value, decimals, MidpointRounding.AwayFromZero);
            }
        } 
    }
}
